% TEST_ID: LANG-EXPAND-0083
% CATEGORY: stdlib/arithmetic_ops/triangle
% 测试 三角函数

function test_acoth_atan_acosd_acotd()
assert(isequal(acoth(1), inf))
assert(abs(acoth(7) - 0.143841036225890) < 1e-12)
assert(abs(real(acoth(2+2i)) - 0.238877861256859) < 1e-12 && abs(imag(acoth(2+2i)) + 0.259573057123261) < 1e-12)
assert(abs(real(acoth(0.5)) - 0.549306144334055) < 1e-12 && abs(imag(acoth(0.5)) - 1.570796326794897) < 1e-12)
assert(abs(real(acoth(-0.5)) + 0.549306144334055) < 1e-12 && abs(imag(acoth(-0.5)) + 1.570796326794897) < 1e-12)

assert(round(acosd(0.5), 15) == 60.000000000000007)
% assert(round(real(acosd(1.5)), 15) == 0.000000000000000 && round(imag(acosd(1.5)), 15) == 55.142813255405969)
assert(abs(real(acosd(1.5))) < 1e-12 && abs(imag(acosd(1.5)) - 55.142813255405969) < 1e-12)
% assert(round(real(acosd(2+2i)), 15) == 46.784707307449828 && round(imag(acosd(2+2i)), 15) == -99.369475387306522)
assert(abs(real(acosd(2+2i)) - 46.784707307449828) < 1e-10 && abs(imag(acosd(2+2i)) + 99.369475387306522) < 1e-10)

% assert(round(acotd(0.5), 15) == 63.434948822922003)
assert(abs(acotd(0.5) -  63.434948822922003) < 1e-10)
% assert(round(real(acotd(2+2i)), 15) == 14.872440648471111 && round(imag(acotd(2+2i)), 15) == -13.686693269129670)
assert(abs(real(acotd(2+2i)) - 14.872440648471111) < 1e-10 && abs(imag(acotd(2+2i)) + 13.686693269129670) < 1e-10)


assert(round(atan(0.5), 15) == 0.463647609000806)
assert(round(real(atan(2+2i)), 15) == 1.311223269671635 && round(imag(atan(2+2i)), 15) == 0.238877861256859)